package zh.stu.StrategyPattern.PayDemo;

/**
 * @Author：KoVaVo
 * @Version：1.0.0
 * @Description： 支付渠道
 */
public abstract class Payment {

    public abstract String getName();

    //将通用的逻辑放到抽象类的里面实现    判断余额是否够用
    public MsgResult pay(String uid,double amout){
        if(queryBalance(uid) < amout){
            return new MsgResult(500,"failure","没钱了。。");
        }
        return  new MsgResult(200,"success","支付成功");
    }

    protected abstract double queryBalance(String uid);
}

